package cn.edu.ctbu.api01.repository;
import cn.edu.ctbu.api01.domain.Student;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;

@Repository
public interface  StudentRepository extends JpaRepository<Student,Integer> {
    List<Student> findByNameLike(String name);//按名字查询
//    @Query("SELECT t FROM tb_student t WHERE SUBSTRING(t.no, 1, 4) = (SELECT MAX(SUBSTRING(tt.no, 1, 4)) FROM tb_student tt) ORDER BY t.no DESC")
//    List<Student> findStudentsWithMaxNo();
    public Page<Student> findAll(Pageable pageable);
    /*
    找出所有的符号指定姓名和密码的用户
     */
    List<Student> findByNameAndPassword(String name,String password);
};